<extend name="_Layout/main"/>

<block name="style">
</block>

<block name="main">
    <section>
        <section class="vbox">
            <section id="vbox" class="scrollable wrapper-lg">
                 <div class="row row-container-doc">
                     <div class="col-xs-12 col-sm-9 container-tiezi">
                         <!-- 文档详情页面顶部钩子 -->
                         <div class="clearfix hook hook-document-detail-before">
                             {:hook('DocumentDetailBefore')}
                         </div>

                         <!-- 文章内容 -->
                         <article class="article">
                             <div class="entry-cover">
                                <img width="700" height="350" src="{$info.cover|get_cover='default'}" class="attachment-post-thumbnail wp-post-image" alt="{$info.main_field}" itemprop="image" lazyload="1">
                             </div>
                             <!-- 文章标题 -->
                             <div class="article-title">
                                 <h3 class="text-muted-5">{$info.main_field}</h3>
                             </div>
                             <!-- 文章信息 -->
                             <div class="article-info text-muted">
                                 <ul class="list-unstyled list-inline">
                                     <li><a href="{:U('User/home/uid/'.$info['uid'])}"><i class="fa fa-user"></i> {$info.username}</a></li>
                                     <li><i class="fa fa-calendar"></i> {$info.utime|time_format='Y-m-d'}</li>
                                     <li><i class="fa fa-eye"></i> {$info.view} 浏览</li>
                                     <li><i class="fa fa-comments"></i> {$info.comment} 评论</li>
                                     <li><i class="fa fa-thumbs-o-up"></i> {$info.good} 赞</li>
                                 </ul>
                             </div>
                             <!-- 文章摘要 -->
                             <notempty name="info.abstract">
                                 <div class="article-abstract">
                                     <blockquote class="abstract">
                                         <small>{$info.abstract}</small>
                                     </blockquote>
                                 </div>
                             </notempty>
                             <!-- 引入音乐播放器css / JS -->
                             <div class="m-b-lg">
                                 <a href="javascript:;" data-id="{$info.id}" class="play-me btn btn-default btn-icon detail_play" style="width:150px;">
                                     <i class="fa fa-play text">&nbsp;&nbsp;&nbsp;&nbsp;我是一枚播放按钮</i>
                                     <i class="fa fa-pause text-active">&nbsp;&nbsp;&nbsp;&nbsp;我是一枚暂停按钮</i>
                                 </a>
                             </div>
                             <!-- music_box End -->
                             <!-- 文章正文 -->
                             <div class="article-body">
                                 {$info.content|parse_content}
                             </div>
                             <!-- 文件下载-->
                             <notempty name="info.file_list">
                                 <div class="article-download">
                                     <ul class="list-group">
                                         <volist name="info.file_list" id="file">
                                             <a class="list-group-item" href="{:U('Home/PublicUpload/download', array('id' => $file['id']))}" title="点击下载">
                                                 <span class="badge">下载次数：{$file.download}</span>
                                                 <span class="down-icon">{$file.show}</span>
                                                 <span class="down-name text-muted">{$file.name}</span>
                                             </a>
                                         </volist>
                                     </ul>
                                 </div>
                             </notempty>
                             <!-- 文章导航 -->
                             <div class="article-pager">
                                 <hr>
                                 <nav id="postination" tole="navigation">
                                     <span class="previous-post">
                                         <a href="{$info.previous.href}" rel="prev"><span class="arrows">‹</span> 上一篇</a>
                                     </span>
                                     <span class="dot"> • </span>
                                     <span class="next-post">
                                         <a href="{$info.next.href}" rel="next">下一篇 <span class="arrows">›</span></a>
                                     </span>
                                 </nav>
                                 <hr>
                             </div>
                         </article>

                         <!-- 文章点赞 -->
                         <div class="article-digg text-center padding-top">
                             <a href="{:U('PublicDigg/digg/', array('table' => $__CURRENT_TABLE_ID__, 'data_id' => $info['id'], 'type' => '1'))}" class="btn btn-danger-inverse btn-pills digg-good ajax-digg">
                                 <span class="text"><span class="fa fa-thumbs-o-up"></span> 点赞</span>
                                 <span class="num">{$info.good}</span>
                             </a>
                             <a href="{:U('PublicDigg/digg/', array('table' => $__CURRENT_TABLE_ID__, 'data_id' => $info['id'], 'type' => '3'))}" class="btn btn-success-inverse btn-pills digg-mark ajax-digg">
                                 <span class="text"><span class="fa fa-star-o"></span> 收藏</span>
                                 <span class="num">{$info.mark}</span>
                             </a>
                             <div class="btn-group">
                                 <a class="btn btn-info-inverse btn-pills dropdown-toggle" data-toggle="dropdown">
                                     <span class="text"><span class="fa fa-share"></span> 分享</span>
                                     <span class="caret"></span>
                                 </a>
                                 <ul class="dropdown-menu">
                                     <li><a href="#">微信</a></li>
                                     <li><a href="#">朋友圈</a></li>
                                     <li><a href="#">微博</a></li>
                                     <li><a href="#">QQ空间</a></li>
                                 </ul>
                             </div>
                         </div>

                         <!-- 包含评论 -->
                         <include file="Comment/default" />

                         <!-- 文档详情页面底部钩子 -->
                         <div class="clearfix hook hook-document-detail-after">
                             {:hook('DocumentDetailAfter')}
                         </div>
                     </div>
                     <div class="col-xs-12 col-sm-3 hidden-xs">
                         <div class="widget-1 widget-odd widget_text widget">
                             <h4 class="widget-title">ABOUT ME</h4>
                             <div class="textwidget">
                              <section class="panel panel-default">
                                 <header class="panel-heading bg-light no-border">
                                    <div class="clearfix">
                                         <a target="_blank" href="{:U('User/home/uid/'.$info['uid'])}" class="pull-left thumb-md avatar b-3x m-r">
                                            <img src="{$info.avatar|get_cover='avatar'}">
                                         </a>
                                         <div class="clear">
                                            <div class="h3 m-t-xs m-b-xs"> {$info.username} <i class="fa fa-circle text-success pull-right text-xs m-t-sm"></i> </div>
                                            <small class="text-muted">{$info.summary}</small>
                                         </div>
                                     </div>
                                 </header>
                              </section>
                            </div>
                         </div>
                         <!-- 侧边导航 -->
                         <h4 class="widget-title">NAVIGATION</h4>
                         <div class="list-group">
                             <a href="{:U('Document/add', array('cid' => $__CURRENT_CATEGORY__))}" class="btn btn-primary btn-block">发表文章</a>
                             <corethink:category_list name="vo" pid="$__CURRENT_CATEGORY__">
                                 <a class="list-group-item <if condition='$vo.id eq $__CURRENT_CATEGORY__'>active</if>" href="{:U('Document/index', array('cid' => $vo['id']))}">
                                    {$vo.title}
                                </a>
                             </corethink:category_list>
                         </div>

                         <!-- 页面侧边栏钩子 -->
                         <div class="clearfix hook hook-page-side">
                             {:hook('PageSide')}
                         </div>
                     </div>
                 </div>
            </section>
        </section>
    </section>
</block>
<block name="script">
    <script type="text/javascript">
        $(function(){
            // //已赞设置高亮
            $.get("{:U('PublicDigg/getDiggStatus/', array('table' => $__CURRENT_TABLE_ID__, 'data_id' => $info['id'], 'type' => '1'))}").success(function(data){
                if(data.status == 1){
                    $('.digg-good').addClass('hover');
                }
            });

            //已收藏设置高亮
            $.get("{:U('PublicDigg/getDiggStatus/', array('table' => $__CURRENT_TABLE_ID__, 'data_id' => $info['id'], 'type' => '3'))}").success(function(data){
                if(data.status == 1){
                    $('.digg-mark').addClass('hover');
                }
            });

            //Digg
            $('.ajax-digg').click(function () {
                var target;
                var that = this;
                var type = $(this).attr('type')
                if ((target = $(this).attr('href')) || (target = $(this).attr('url'))) {
                    $.get(target).success(function (data) {
                        if (data.status == 1) {
                            if (data.digg_status == 1) {
                                $(that).addClass('hover');
                            } else {
                                $(that).removeClass('hover');
                            }
                            $(that).find('span.num').css({ 'opacity': '0' }).text(data.digg_count).animate({ opacity: '1' });
                        } else {
                            if (data.login == 1) {
                                $('#login-modal').modal(); //弹出登陆框
                            } else {
                                $.alertMessager(data.info, 'danger');
                            }
                        }
                    });
                }
                return false;
            });
        });
    </script>
</block>
